{% extends "base.html" %}

{% block extrahead %}
<script type="text/javascript">

    function handleYesNoMaybe(response, ioArgs) {
        dojo.byId("yesnomaybe").innerHTML = response;
        return response;
        
    }
    function errorFunc(response, ioArgs) {
        console.error("HTTP Error: ", ioargs.xhr.status);
        return response;
    }
    function yesnomaybe(status, event_id) {
        dojo.xhrGet( {
            url: "/events/"+event_id+"/"+status,
            timeout: 5000,
            load: handleYesNoMaybe,
            error: errorFunc
        })
    
    }

</script>

{% endblock %}

{% block body %}
<p>
This is event <a href="/events/{{event_id}}">{{ event_id }}</a> (click to refresh)
</p>

<div id="yes"><b>Going</b> (<strong>{{yes_count}}</strong>)
{% with reservations.YES as filtered_reservations %}
{% include "reservations.html" %}
{% endwith %}
</div>
<div id="no"><b>Not Going</b> (<strong>{{no_count}}</strong>)
{% with reservations.NO as filtered_reservations %}
{% include "reservations.html" %}
{% endwith %}
</div>
<div id="maybe"><b>Unable to decide</b> (<strong>{{maybe_count}}</strong>)
{% with reservations.MAYBE as filtered_reservations %}
{% include "reservations.html" %}
{% endwith %}
</div>


<p>
{% if openid %}
Will you be going, {{ identity.name }}? <div id="yesnomaybe">
{% include "yesnomaybe.html" %}
</div>
{% endif %}

{% endblock %}
